#include<stdio.h>
struct time
{
	int year;
	int month;
	int day;
};

int leap(int a)
{
	if(a%4==0&&a%100!=0||a%400==0)
		return 1;
	else
		return 0;
}
int number(struct time *test)
{
	int sum=0;
	int i,j,k;
	int a[12]= {31,28,31,30,31,30,31,31,30,31,30,31};
	int b[12]= {31,29,31,30,31,30,31,31,30,31,30,31};
	if (leap(test->year)==1)
	{
		for(i=0; i<test->month-1; i++)
		{
			sum+=b[i];
		}
	}
	else
	{
		for(j=0; j<test->month-1; j++)
		{
			sum+=a[j];
		}
	}
	sum+=test->day;
	return sum;
}
int main ()
{
	struct time test;
	int n;
	while(scanf("%d-%d-%d",&test.year,&test.month,&test.day)!=EOF)
	{
		n=number(&test);
		printf("%d\n",n);
	}
	return 0;
}
